#include "HTTPServer.h"
#include "HTTPRequest.h"

HTTPServer::HTTPServer(int _port):
	port(_port)
{
	server=new SocketServer(port,*this);
}
HTTPServer::~HTTPServer()
{
	delete server;
}
HTTPServer::HTTPServer(const HTTPServer& src)
{
	throw exception("can't copy HTTPServer instance");
}
HTTPServer& HTTPServer::operator=(const HTTPServer& src)
{
	throw exception("can't assign HTTPServer instance");
	return *this;
}

void HTTPServer::Start()
{
	server->Start();
}
bool HTTPServer::OnData(char* request,int requestLength,char** response,int* responseLength)
{
	HTTPRequest httpRequest(request,requestLength);
	httpRequest.GetResponse(response,responseLength);
	return false;
}